package cn.itlaobing.springbootdemo.entity;

import org.springframework.data.jpa.domain.AbstractPersistable;

import javax.persistence.*;
import java.util.Date;

@Entity
@Table(name="students")
public class Student extends AbstractPersistable<Long>{

    private String name;
    @Enumerated(EnumType.STRING) //数据库中存储的是枚举的字面字符串
    @Column(length = 10,nullable = false,name ="gender")
    private Gender gender=Gender.FEMAL;
    private Date birthday;
    private String no;
    @OneToOne(mappedBy = "student")
    private SystemAccount systemAccount;

    @ManyToOne
    @JoinColumn(name = "classes_id")
    private Classes classes;

    public Classes getClasses() {
        return classes;
    }

    public void setClasses(Classes classes) {
        this.classes = classes;
    }

    public SystemAccount getSystemAccount() {
        return systemAccount;
    }

    public void setSystemAccount(SystemAccount systemAccount) {
        this.systemAccount = systemAccount;
    }

    public String getNo() {
        return no;
    }

    public void setNo(String no) {
        this.no = no;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public Gender getGender() {
        return gender;
    }

    public void setGender(Gender gender) {
        this.gender = gender;
    }

    public Date getBirthday() {
        return birthday;
    }

    public void setBirthday(Date birthday) {
        this.birthday = birthday;
    }

    public enum Gender{
        MALE,FEMAL
    }
}
